package me.huha.zhime.entity;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Table;

import me.huha.ibatis.Entity;

/**
 * @Title: OrderInfoEntity
 * @Author: Yepx
 * @mail: yepx2013@gmail.com
 * @CreateTime: 2017年10月25日 上午11:37:20
 * @Todo: 订单基本信息
 */
@Table
@javax.persistence.Entity
public class OrderInfoEntity extends Entity<OrderInfoEntity> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4857308633869137032L;
	
	private String orderNum;			//订单号
	private String goodName;			//商品名称
	private BigDecimal orderAmount;		//订单金额
	private Date orderCreate;			//订单创建时间
	private Date orderClose; 			//订单关闭时间
	private String payType;				//订单支付类型
	private Integer paymentStatus;		//订单状态
	
	/**
	 * @Title: PaymentStatusEnum
	 * @Author: Yepx
	 * @mail: yepx2013@gmail.com
	 * @CreateTime: 2017年10月26日 下午4:55:46
	 * @Todo: 支付状态
	 */
	public enum PaymentStatusEnum {
		
		unpaid(0, "未支付"),
		paid(1, "已支付"),
		paidAbnormal(2, "支付异常"),
		orderClose(3, "订单关闭");
		
		private Integer status;
		private String name;
		
		private PaymentStatusEnum(Integer status, String name) {
			this.status = status;
			this.name = name;
		}

		public Integer getStatus() {
			return status;
		}

		public void setStatus(Integer status) {
			this.status = status;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public static PaymentStatusEnum getPaymentStatusEnumByStatus(Integer status){
			
			for (PaymentStatusEnum enum_ : PaymentStatusEnum.values()) {
				if(enum_.getStatus().equals(status)){
					return enum_;
				}
			}
			
			return null;
		}
	}
	
	public String getOrderNum() {
		return orderNum;
	}
	public void setOrderNum(String orderNum) {
		this.orderNum = orderNum;
	}
	public String getGoodName() {
		return goodName;
	}
	public void setGoodName(String goodName) {
		this.goodName = goodName;
	}
	public BigDecimal getOrderAmount() {
		return orderAmount;
	}
	public void setOrderAmount(BigDecimal orderAmount) {
		this.orderAmount = orderAmount;
	}
	public Date getOrderCreate() {
		return orderCreate;
	}
	public void setOrderCreate(Date orderCreate) {
		this.orderCreate = orderCreate;
	}
	public String getPayType() {
		return payType;
	}
	public void setPayType(String payType) {
		this.payType = payType;
	}
	public Integer getPaymentStatus() {
		return paymentStatus;
	}
	public void setPaymentStatus(Integer paymentStatus) {
		this.paymentStatus = paymentStatus;
	}
	public Date getOrderClose() {
		return orderClose;
	}
	public void setOrderClose(Date orderClose) {
		this.orderClose = orderClose;
	}
}
